package com.cancer.biz.datasource;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource;

/**
 * 数据源路由
 * 
 * @company GeekPlus
 * @project beetle
 * @author 刘俊
 * @date Jun 15, 2017
 * @since 1.0.0
 */
public class MultipleDataSource extends AbstractRoutingDataSource {
	private static final Logger logger = LoggerFactory.getLogger(MultipleDataSource.class);

	@Override
	protected Object determineCurrentLookupKey() {
		logger.info("current thread [{}] datasource is {}", Thread.currentThread().getName(), DataSourceTypeManager.get());
		return DataSourceTypeManager.get();
	}

}
